<?php

class User_Action_Admin_Manage_Sendmail  extends Action_Admin
{
	function execute($request, $initial = true, $script = null)
	{

		if ($initial = true)
		{
			Agilet::setVar('breadcrum', array(
				array(
					'url' => 'admin/user',
					'label' => 'User'
				),
				array(
					'url' => 'admin/user/manage',
					'label' => 'Manage'
				),
				array(
					'url' => 'admin/user/manage/sendmail',
					'label' => 'Send Message'
				),
			));
		}
		$form = Form::factory('user/admin/sendmail');

		$id = (int)$request -> getParam('id');

		$table = Model::getTable('user');

		$user = $table -> find($id) -> current();

		if ($request -> isPost() && $form -> isValid($_POST))
		{
			$value = $form -> getData();
			Response::redirect('admin/user/manage');
		}
		
		$request -> response = View::render($script = 'core/html/admin/edit', $data = array(
			'form' => $form,
			'title'=>'Reset Password',
		));
	}

}
